package top.oylan.manager.tools;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @Author abduahad
 * @Description ${description}
 * @Date 2019-02-17
 */
@Configuration
public class ConfigFilter implements Filter {

    @Value("${systemConfig.imageService}")
    private String imageService;

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        setOptions(request);
        filterChain.doFilter(request,servletResponse);
    }

    private void setOptions(HttpServletRequest request){
        request.setAttribute("imageService",imageService);
    }
}
